package com.tuozixuan.repository;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.stream.Stream;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

import com.tuozixuan.entity.Person;
import com.tuozixuan.entity.Persons;
import com.tuozixuan.entity.Persons2;
import com.tuozixuan.entity.Persons3;

public interface PersonRepository extends ElasticsearchRepository<Person, String> {

	List<Person> findByFirstName(String firstName);
	
    List<Person> findByLastName(String lastName);
    
    List<Person> findByName(String name);
    
    List<Person> findByNameNot(String name);
    
    List<Person> findByPrice(Integer price);
    
    List<Person> findByNameAndPrice(String name, Integer price);
    
    List<Person> findByNameOrPrice(String name, Integer price);
    
    List<Person> findByPriceBetween(Integer from, Integer to);
    
    List<Person> findByPriceLessThan(Integer to);
    
    List<Person> findByPriceLessThanEqual(Integer to);
    
    List<Person> findByPriceGreaterThan(Integer from);
    
    List<Person> findByPriceGreaterThanEqual(Integer from);
    
    List<Person> findByPriceBefore(Integer to);
    
    List<Person> findByPriceAfter(Integer from);
    
    List<Person> findByNameLike(String nameKey);
    
    List<Person> findByNameStartingWith(String namePrefix);
    
    List<Person> findByNameEndingWith(String nameSuffix);
    
    List<Person> findByNameContaining(String nameItem);
    
    List<Person> findByNameIn(List<String> nameList);
    
    List<Person> findByNameNotIn(List<String> nameList);
    
    List<Person> findByMemberFlagTrue();
    
    List<Person> findByMemberFlagFalse();
    
    List<Person> findByMemberFlagTrueOrderByPriceDesc();
    
    List<Person> findByBirthDateBetween(Date from, Date to);
    
    List<Person> findByAmountBetween(BigDecimal from, BigDecimal to);
    
    List<Person> findByAmountBetween(BigDecimal from, BigDecimal to, Sort sort);
    
    Page<Person> findByNameIn(List<String> nameList, Pageable pageable);
    
    Person findFirstByLastName(String lastName);
    
    List<Person> findFirst2ByLastName(String lastName);
    
    Person findTopByLastName(String lastName);
    
    List<Person> findTop2ByLastName(String lastName);
    
    Stream<Person> findByStatus(Integer status);
    
    Persons findFirst3ByLastName(String lastName);
    
    Persons2 findFirst4ByLastName(String lastName);
    
    Persons3 findFirst5ByLastName(String lastName);
}
